﻿using Configuration;
using StructureMap;

namespace Repository
{
    public class RepositoryManager
    {
        public static void Register(Database context)
        {
            ObjectFactory.Initialize(x =>
            {
                x.For<UserRepository>().Use<UserRepository>().Ctor<Database>().Is(context);
                x.For<InformationRepository>().Use<InformationRepository>().Ctor<Database>().Is(context);
                x.For<tkntCategoryRepository>().Use<tkntCategoryRepository>().Ctor<Database>().Is(context);
                x.For<tkntProductRepository>().Use<tkntProductRepository>().Ctor<Database>().Is(context);
                x.For<tkntImageRepository>().Use<tkntImageRepository>().Ctor<Database>().Is(context);
            });
        }

        public static UserRepository CreateUserRepository()
        {
            return ObjectFactory.GetInstance<UserRepository>();
        }

        public static InformationRepository CreateInformationRepository()
        {
            return ObjectFactory.GetInstance<InformationRepository>();
        }

        public static tkntCategoryRepository CreateTKNTCategoryRepository()
        {
            return ObjectFactory.GetInstance<tkntCategoryRepository>();
        }

        public static tkntProductRepository CreateTKNTProductRepository()
        {
            return ObjectFactory.GetInstance<tkntProductRepository>();
        }

        public static tkntImageRepository CreateTKNTImageRepository()
        {
            return ObjectFactory.GetInstance<tkntImageRepository>();
        }
    }
}